<template>
  <div class="header clearfix">
    <div class="logo">faya的后台管理系统</div>
    <div class="user-info" @click="logout">
      退出
    </div>
  </div>
</template>

<script>
export default {
  name: 'header',
  methods: {
    logout() {
      this.$confirm('你确定是要退出吗?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      })
        .then(() => {
          this.$message({
            type: 'success',
            message: '退出成功!'
          });
          this.$router.push('/');
        })
        .catch(() => {
          this.$message({
            type: 'info',
            message: '已取消'
          });
        });
    }
  }
};
</script>

<style lang="less" scoped>
.header {
  width: 100%;
  height: 70px;
  font-size: 22px;
  line-height: 70px;
  background: rgb(0, 120, 204);
  color: #ffffff;
  .logo {
    margin-left: 20px;
    float: left;
  }
  .user-info {
    float: right;
    margin-right: 20px;
  }
}
</style>
